import request from '../utils/request'
import { getToken } from '@/utils/token.js'
// 登录-登录接口
export const LoginAPI = ({ mobile, code }) => {
  return request({
    url: '/v1_0/authorizations',
    method: 'POST',
    data: {
      mobile,
      code
    }
  })
}
// 频道-获取所有频道
export const allXChannelListAPI = () => {
  return request({
    url: '/v1_0/channels'
  })
}
// 频道-获取用户的频道
export const getUserChannelsAPI = () => request({
  url: '/v1_0/user/channels',
  headers: {
    Authorization: `Bearer ${getToken()}`
  }
})
// 新闻-获取文章新闻推荐(获取文章列表)
export const getArticleNewsAPI = ({ channel_id, timestamp }) => request({
  url: '/v1_0/articles',
  headers: {
    Authorization: `Bearer ${getToken()}`
  },
  params: {
    channel_id: channel_id,
    timestamp: timestamp
  }
})
